package org.flown.shop.entity;


import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

public class BaseEntity
{
    protected int id = 0;//从1开始


    public void setID(int id){this.id = id;}
    public int getID(){return this.id;}
    public void setId(int id){this.id = id;}
    public int getId(){return this.id;}

    public String asJSONString()
    {
        try {
            return new ObjectMapper().writeValueAsString(this);
        } catch (JsonProcessingException e) {
            e.printStackTrace();
            return null;
        }
    }
}

